#include "mydialog.h"
#include "ui_mydialog.h"
#include <QFileDialog>

myDialog::myDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::myDialog)
{
    ui->setupUi(this);
    QRegExp regExp("[A-Za-z][1-9][0-9]{0,2}");
    ui->editUsername->setValidator(new QRegExpValidator(regExp, this));
    connect(ui->btnOk,SIGNAL(clicked()), this, SLOT(accept()));
    connect(ui->btnCancel,SIGNAL(clicked()), this, SLOT(reject()));
}

void myDialog::on_editUsername_textChanged(){
    ui->btnOk->setEnabled(ui->editUsername->hasAcceptableInput());
}

void myDialog::on_btnOpenFile_clicked()
{
    QString str = QFileDialog::getExistingDirectory(this, tr("选择路径"), tr("./"), QFileDialog::ShowDirsOnly);
    ui->edtFilePath->setText(str);
}

myDialog::~myDialog()
{
    delete ui;
}